import {
  isKSMiniProgram,
  isVideoDistribution,
  isOnlyCMN,
  isMutilCMN,
  isBrandApp,
  isELearnApp,
  isWechatBrowser,
  isMiniProgramSdk
} from "./check-env";

//应用
export const AppType = {
  WX_MINI_PROGRAM: 'WX_MINI_PROGRAM',//微信小程序
  VIDEO_DISTRIBUTION: "VIDEO_DISTRIBUTION", //视频号分销小程序
  KS_MINI_PROGRAM: "KS_MINI_PROGRAM", //快手小程序
  COMMUNITY: "COMMUNITY", //独立圈子小程序
  E_COMMUNITY: "E_COMMUNITY", //圈子小程序
  BRAND: "BRAND", //品牌app
  E_LEARN_APP: "E_LEARN_APP", //鹅学习app
  WEB_SDK: 'WEB_SDK',//SDK
  WX_MINI_PROGRAM_SDK: 'WX_MINI_PROGRAM_SDK',//小程序sdk
  UNKNOWN: "UNKNOWN"//未知
};

export function getAppType() {
  if (isKSMiniProgram) {
    return AppType.KS_MINI_PROGRAM;
  }
  if (isVideoDistribution) {
    return AppType.VIDEO_DISTRIBUTION;
  }
  if (isOnlyCMN && !isWechatBrowser) {
    return AppType.COMMUNITY;
  }
  if (isMutilCMN && !isWechatBrowser) {
    return AppType.E_COMMUNITY;
  }
  if (isBrandApp) {
    return AppType.BRAND;
  }
  if (isELearnApp) {
    return AppType.E_LEARN_APP;
  }
  if (isMiniProgramSdk) {
    return AppType.WX_MINI_PROGRAM_SDK
  }
  return AppType.UNKNOWN;
}
